<?=view('admin.common.header')?>
<?=view('admin.common.nav')?>
<div class="container">
    <div class="row">
        <div class="panel panel-default">
            <div class="panel-heading">
                装维人员<a href="<?= url("admin/instper/add") ?>" class="btn btn-success btn-xs eveAdd" style="float: right;">添加装维人员</a>
            </div>
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>姓名</th>
                        <th>联系电话</th>
                        <th>管理小区</th>
                        <th>#</th>
                    </tr>
                </thead>
                <tbody>
                    <?php if ($instpersons && count($instpersons)): ?>
                    <?php foreach ($instpersons as $val): ?>
                    <tr>
                        <td><?= $val->name?></td>
                        <td><?= $val->phone ?></td>
                        <td><?= $val->strPlot() ?></td>
                        <td>
                            <a href="<?=url("admin/instper/modplot/{$val->id}")?>" class="btn btn-xs btn-info eveMod">分配管理小区</a>
                        </td>
                    </tr>
                    <?php endforeach; ?>
                    <?php endif; ?>
                </tbody>
            </table>
        </div> 
    </div>
</div>
<script>
    $('.eveDel').click(function(){
        var url = $(this).attr('href');
        layer.confirm('确定要执行删除操作？', {icon:3,title: '删除'}, function(){
            $.get(url, function(data){
               layer.msg(data.info,{icon: 1});
               if (data.status==1) {
                   window.location.reload();
               }
            });
        });
        
        return false;
    });
    $(".eveMod").click(function(){
        var url = $(this).attr("href");
        layer.open({
            type: 2,
            title: '重新分配管理小区',
            shadeClose: false,
            shade: 0.8,
            area: ['500px', '460px'],
            content: url
        }); 
        return false;
    });
</script>
<?=view('admin.common.footer')?>